import java.util.Arrays;

public class test2 {
    public static void swap(int [] array, int i, int j) {
        int tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
    }
    public static void fun(int [] array) {
        for (int j = 0; j < array.length-1; j++) {
            for (int i = 0; i < array.length-1-j; i++) {
                if(array[i] % 2 == 0) {
                    swap(array,i,i+1);
                }
            }
        }
    }
    public static void main(String[] args) {
        int [] array = {1,3,5,7,6,9,2,7,4};
        fun(array);
        System.out.println(Arrays.toString(array));
    }
}
